﻿using ApiTest.Model;
using Dapper;
using Dapper.Core;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace ApiTest.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HomeController : ControllerBase
    {
        private readonly IBaseRepository _baseRepository;
        public HomeController(IBaseRepository baseRepository)
        {
            _baseRepository = baseRepository;
        }

        [HttpGet]
        public IActionResult Get()
        {
            var dynamicParams = new DynamicParameters();
            dynamicParams.Add("Id", "6a53d92fea45");
            var result = _baseRepository.QueryFirstOrDefault<SysUserInfo>("select * from sys_userinfo where Id = @Id", dynamicParams);
            return Ok(result);
        }
    }
}
